*log using Mediation.log, replace 
version 12
set more off 
use "UNSC Survey III (2014Sept4to10).dta", replace

*Drop non-serious respondents by the below 25 seconds answer time for the first page
drop if duration_q01exp<25

*Recode Q1 and Q3 to 1 = Do not support, 2 = Do not really support, 3 = Somehow support, 4 = Support  
recode q01 (1=4)(2=3)(3=2)(4=1)
recode q03 (1=4)(2=3)(3=2)(4=1)
label var q01 "DV 1: do not suport" 
label var q03 "DV2 (JSDF) 1: do not suport" 
label var q06 "1: favor ~ 4: unfavor" 

gen support_dum=1 if q01==3 |q01==4
replace support_dum=0 if q01==1 |q01==2
label var support_dum "q01's dummy"
tab support_dum q01

gen support_dum2=1 if q03==3 |q03==4
replace support_dum2=0 if q03==1 |q03==2
label var support_dum2 "q03's dummy"
tab support_dum2 q03

gen uof_categ  = q06
label var uof_categ "1: favor, 2: somewhat favor, 3: somewhat unfavor, 4: unfavor"
tab uof_categ

gen uof_categ2=1 if q06==1 | q06==2 
replace uof_categ2=2 if q06==3 | q06==4
replace uof_categ2=3 if q06==.
label var uof_categ2 "1: favor, 2: unfavor, 3: unknown"
tab uof_categ2

gen uof_favor=1 if uof_categ2==1
recode uof_favor(.=0)
gen uof_unfavor=1 if uof_categ2==2
recode uof_unfavor(.=0)
gen uof_DNK=1 if uof_categ2==3
recode uof_DNK(.=0)
label var uof_favor "dummy "
label var uof_unfavor "dummy "
label var uof_DNK "dummy "
*tab uof_favor uof_categ2
*tab uof_unfavor uof_categ2
*tab uof_DNK uof_categ2


*Multiple Comparison Tukey's method
anova q01 pat
prcomp q01 pat, tukey
anova q02_1 pat
prcomp q02_1 pat, tukey
anova q02_2 pat
prcomp q02_2 pat, tukey
anova q02_3 pat
prcomp q02_3 pat, tukey
anova q02_4 pat
prcomp q02_4 pat, tukey
anova q02_5 pat
prcomp q02_5 pat, tukey
anova q02_6 pat
prcomp q02_6 pat, tukey
anova q02_7 pat
prcomp q02_7 pat, tukey
anova q02_8 pat
prcomp q02_8 pat, tukey
anova q02_9 pat
prcomp q02_9 pat, tukey
anova q03 pat
prcomp q03 pat, tukey

****
* By trust to country and institution
****
recode q04_1 (1=4)(2=3)(3=2)(4=1)(5=.)(6=.)
recode q04_2 (1=4)(2=3)(3=2)(4=1)(5=.)(6=.)
recode q04_3 (1=4)(2=3)(3=2)(4=1)(5=.)(6=.)
recode q04_4 (1=4)(2=3)(3=2)(4=1)(5=.)(6=.)
recode q04_5 (1=4)(2=3)(3=2)(4=1)(5=.)(6=.)
recode q04_6 (1=4)(2=3)(3=2)(4=1)(5=.)(6=.)
recode q04_7 (1=4)(2=3)(3=2)(4=1)(5=.)(6=.)
label var q04_1 "Trust to JPN Gov" 
label var q04_2 "Trust to USA Gov" 
label var q04_3 "Trust to UK Gov" 
label var q04_4 "Trust to FRN Gov" 
label var q04_5 "Trust to RUS Gov" 
label var q04_6 "Trust to CHN Gov" 
label var q04_7 "Trust to UN" 

generate trustJPN =0
replace trustJPN =1 if q04_1==4
replace trustJPN =1 if q04_1==4
generate trustUSA =0
replace trustUSA =1 if q04_2==4
replace trustUSA =1 if q04_2==3
generate trustUK =0
replace trustUK =1 if q04_3==4
replace trustUK =1 if q04_3==3
generate trustFRN =0
replace trustFRN =1 if q04_4==4
replace trustFRN =1 if q04_4==3
generate trustRUS =0
replace trustRUS =1 if q04_5==4
replace trustRUS =1 if q04_5==3
generate trustCHN =0
replace trustCHN =1 if q04_6==4
replace trustCHN =1 if q04_6==3
generate trustUN =0
replace trustUN =1 if q04_7==4
replace trustUN =1 if q04_7==3

sort trustUN
by trustUN: anova q01 pat
by trustUN: tab q01 pat, col

sort trustUSA
by trustUSA: anova q01 pat
by trustUSA: tab q01 pat, col

sort trustUN
by trustUN: anova q02 pat
by trustUN: tab q02 pat, col

sort trustUSA
by trustUSA: anova q02 pat
by trustUSA: tab q02 pat, col

****
* generate treatment vars
****
gen tmt_s = 1 if pat==1
recode tmt_s(.=0) 
gen tmt_rv = 1 if pat==2
recode tmt_rv(.=0)
gen tmt_cv = 1 if pat==3
recode tmt_cv(.=0)
gen tmt_fv = 1 if pat==4
recode tmt_fv(.=0)
gen tmt_ukv = 1 if pat==5
recode tmt_ukv(.=0)
gen tmt_usw = 1 if pat==6
recode tmt_usw(.=0)
sum tmt_*


***
* Treatment Effects | Expressed Use of Force Preferences
***
bysort trustUN: reg support_dum tmt_rv tmt_cv tmt_fv tmt_ukv tmt_usw
bysort trustUSA: reg support_dum tmt_rv tmt_cv tmt_fv tmt_ukv tmt_usw

save "UNSC Survey III (2014Sept4to10)c.dta", replace


***
* Support RATE for Q1 by use of force preferences
***
use "UNSC Survey III (2014Sept4to10)c.dta", clear

*(1) Support Rate: Trust UN 
gen mean_f =.
gen std_f =.
gen n_f =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & trustUN==1
	replace mean_f = r(mean) if pat==`i' & trustUN==1
    replace std_f = r(sd) if pat==`i' & trustUN==1
    replace n_f = r(N) if pat==`i' & trustUN==1
	}
gen upper_f=mean_f+1.96*std_f/sqrt(n_f)
gen lower_f=mean_f-1.96*std_f/sqrt(n_f)
replace mean_f=round(mean_f, .01)

twoway (rcap lower_f upper_f pat) (scatter mean_f pat, mlabel(mean_f)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save trustUN1, replace 

*(2) Support Rate: Not-trust UN 
gen mean_unf =.
gen std_unf =.
gen n_unf =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & trustUN==0
	replace mean_unf = r(mean) if pat==`i' & trustUN==0
    replace std_unf = r(sd) if pat==`i' & trustUN==0
    replace n_unf = r(N) if pat==`i' & trustUN==0
	}
gen upper_unf=mean_unf+1.96*std_unf/sqrt(n_unf)
gen lower_unf=mean_unf-1.96*std_unf/sqrt(n_unf)
replace mean_unf=round(mean_unf, .01)

twoway (rcap lower_unf upper_unf pat) (scatter mean_unf pat, mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save trustUN0, replace 

*** Overlay for Manuscript (Support Rate by Treatment Group and by Use of Force Preference)
gen pata = pat+0.1
gen patb = pat-0.1
gen patall = pat+0.2

twoway (rcap lower_f upper_f patb) (scatter mean_f patb,msymbol(o) mlabel(mean_f))  (rcap lower_unf upper_unf pata) (scatter mean_unf pata ,msymbol(t) mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") ytitle("% ") legend(label(1 "Trust UN") label(2 " ") label(3 "Non-trust UN") label(4 " ")  rows(1) ) note("Note: Bars indicate 95% confidence intervals.") graphregion(color(white))
graph save trustUNcon, replace 


***
* Support RATE for Q1 by use of force preferences
***
use "UNSC Survey III (2014Sept4to10)c.dta", clear

*(1) Support Rate: Trust USA 
gen mean_f =.
gen std_f =.
gen n_f =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & trustUSA==1
	replace mean_f = r(mean) if pat==`i' & trustUSA==1
    replace std_f = r(sd) if pat==`i' & trustUSA==1
    replace n_f = r(N) if pat==`i' & trustUSA==1
	}
gen upper_f=mean_f+1.96*std_f/sqrt(n_f)
gen lower_f=mean_f-1.96*std_f/sqrt(n_f)
replace mean_f=round(mean_f, .01)

twoway (rcap lower_f upper_f pat) (scatter mean_f pat, mlabel(mean_f)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save trustUSA1, replace 

*(2) Support Rate: Not-trust USA 
gen mean_unf =.
gen std_unf =.
gen n_unf =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & trustUSA==0
	replace mean_unf = r(mean) if pat==`i' & trustUSA==0
    replace std_unf = r(sd) if pat==`i' & trustUSA==0
    replace n_unf = r(N) if pat==`i' & trustUSA==0
	}
gen upper_unf=mean_unf+1.96*std_unf/sqrt(n_unf)
gen lower_unf=mean_unf-1.96*std_unf/sqrt(n_unf)
replace mean_unf=round(mean_unf, .01)

twoway (rcap lower_unf upper_unf pat) (scatter mean_unf pat, mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save trustUSA0, replace 

*** Overlay for Manuscript (Support Rate by Treatment Group and by Use of Force Preference)
gen pata = pat+0.1
gen patb = pat-0.1
gen patall = pat+0.2

twoway (rcap lower_f upper_f patb) (scatter mean_f patb,msymbol(o) mlabel(mean_f))  (rcap lower_unf upper_unf pata) (scatter mean_unf pata ,msymbol(t) mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") ytitle("% ") legend(label(1 "Trust USA") label(2 " ") label(3 "Non-trust USA") label(4 " ")  rows(1) ) note("Note: Bars indicate 95% confidence intervals.") graphregion(color(white))
graph save trustUSAcon, replace 


***
* Support RATE for Q1 by use of force preferences
***
use "UNSC Survey III (2014Sept4to10)c.dta", clear

*(1) Support Rate: Trust UK 
gen mean_f =.
gen std_f =.
gen n_f =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & trustUK==1
	replace mean_f = r(mean) if pat==`i' & trustUK==1
    replace std_f = r(sd) if pat==`i' & trustUK==1
    replace n_f = r(N) if pat==`i' & trustUK==1
	}
gen upper_f=mean_f+1.96*std_f/sqrt(n_f)
gen lower_f=mean_f-1.96*std_f/sqrt(n_f)
replace mean_f=round(mean_f, .01)

twoway (rcap lower_f upper_f pat) (scatter mean_f pat, mlabel(mean_f)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save trustUK1, replace 

*(2) Support Rate: Not-trust UK 
gen mean_unf =.
gen std_unf =.
gen n_unf =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & trustUK==0
	replace mean_unf = r(mean) if pat==`i' & trustUK==0
    replace std_unf = r(sd) if pat==`i' & trustUK==0
    replace n_unf = r(N) if pat==`i' & trustUK==0
	}
gen upper_unf=mean_unf+1.96*std_unf/sqrt(n_unf)
gen lower_unf=mean_unf-1.96*std_unf/sqrt(n_unf)
replace mean_unf=round(mean_unf, .01)

twoway (rcap lower_unf upper_unf pat) (scatter mean_unf pat, mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save trustUK0, replace 

*** Overlay for Manuscript (Support Rate by Treatment Group and by Use of Force Preference)
gen pata = pat+0.1
gen patb = pat-0.1
gen patall = pat+0.2

twoway (rcap lower_f upper_f patb) (scatter mean_f patb,msymbol(o) mlabel(mean_f))  (rcap lower_unf upper_unf pata) (scatter mean_unf pata ,msymbol(t) mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") ytitle("% ") legend(label(1 "Trust UK") label(2 " ") label(3 "Non-trust UK") label(4 " ")  rows(1) ) note("Note: Bars indicate 95% confidence intervals.") graphregion(color(white))
graph save trustUKcon, replace 

***
* Support RATE for Q1 by use of force preferences
***
use "UNSC Survey III (2014Sept4to10)c.dta", clear

*(1) Support Rate: Trust FR
gen mean_f =.
gen std_f =.
gen n_f =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & trustFRN==1
	replace mean_f = r(mean) if pat==`i' & trustFRN==1
    replace std_f = r(sd) if pat==`i' & trustFRN==1
    replace n_f = r(N) if pat==`i' & trustFRN==1
	}
gen upper_f=mean_f+1.96*std_f/sqrt(n_f)
gen lower_f=mean_f-1.96*std_f/sqrt(n_f)
replace mean_f=round(mean_f, .01)

twoway (rcap lower_f upper_f pat) (scatter mean_f pat, mlabel(mean_f)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save trustFRN1, replace 

*(2) Support Rate: Not-trust FRN 
gen mean_unf =.
gen std_unf =.
gen n_unf =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & trustFRN==0
	replace mean_unf = r(mean) if pat==`i' & trustFRN==0
    replace std_unf = r(sd) if pat==`i' & trustFRN==0
    replace n_unf = r(N) if pat==`i' & trustFRN==0
	}
gen upper_unf=mean_unf+1.96*std_unf/sqrt(n_unf)
gen lower_unf=mean_unf-1.96*std_unf/sqrt(n_unf)
replace mean_unf=round(mean_unf, .01)

twoway (rcap lower_unf upper_unf pat) (scatter mean_unf pat, mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save trustFRN0, replace 

*** Overlay for Manuscript (Support Rate by Treatment Group and by Use of Force Preference)
gen pata = pat+0.1
gen patb = pat-0.1
gen patall = pat+0.2

twoway (rcap lower_f upper_f patb) (scatter mean_f patb,msymbol(o) mlabel(mean_f))  (rcap lower_unf upper_unf pata) (scatter mean_unf pata ,msymbol(t) mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") ytitle("% ") legend(label(1 "Trust France") label(2 " ") label(3 "Non-trust France") label(4 " ")  rows(1) ) note("Note: Bars indicate 95% confidence intervals.") graphregion(color(white))
graph save trustFRNcon, replace 


***
* Support RATE for Q1 by use of force preferences
***
use "UNSC Survey III (2014Sept4to10)c.dta", clear

*(1) Support Rate: Trust RUS 
gen mean_f =.
gen std_f =.
gen n_f =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & trustRUS==1
	replace mean_f = r(mean) if pat==`i' & trustRUS==1
    replace std_f = r(sd) if pat==`i' & trustRUS==1
    replace n_f = r(N) if pat==`i' & trustRUS==1
	}
gen upper_f=mean_f+1.96*std_f/sqrt(n_f)
gen lower_f=mean_f-1.96*std_f/sqrt(n_f)
replace mean_f=round(mean_f, .01)

twoway (rcap lower_f upper_f pat) (scatter mean_f pat, mlabel(mean_f)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save trustRUS1, replace 

*(2) Support Rate: Not-trust RUS
gen mean_unf =.
gen std_unf =.
gen n_unf =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & trustRUS==0
	replace mean_unf = r(mean) if pat==`i' & trustRUS==0
    replace std_unf = r(sd) if pat==`i' & trustRUS==0
    replace n_unf = r(N) if pat==`i' & trustRUS==0
	}
gen upper_unf=mean_unf+1.96*std_unf/sqrt(n_unf)
gen lower_unf=mean_unf-1.96*std_unf/sqrt(n_unf)
replace mean_unf=round(mean_unf, .01)

twoway (rcap lower_unf upper_unf pat) (scatter mean_unf pat, mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save trustRUS0, replace 

*** Overlay for Manuscript (Support Rate by Treatment Group and by Use of Force Preference)
gen pata = pat+0.1
gen patb = pat-0.1
gen patall = pat+0.2

twoway (rcap lower_f upper_f patb) (scatter mean_f patb,msymbol(o) mlabel(mean_f))  (rcap lower_unf upper_unf pata) (scatter mean_unf pata ,msymbol(t) mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") ytitle("% ") legend(label(1 "Trust Russia") label(2 " ") label(3 "Non-trust Russia") label(4 " ")  rows(1) ) note("Note: Bars indicate 95% confidence intervals.") graphregion(color(white))
graph save trustRUScon, replace 


***
* Support RATE for Q1 by use of force preferences
***
use "UNSC Survey III (2014Sept4to10)c.dta", clear

*(1) Support Rate: Trust China
gen mean_f =.
gen std_f =.
gen n_f =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & trustCHN==1
	replace mean_f = r(mean) if pat==`i' & trustCHN==1
    replace std_f = r(sd) if pat==`i' & trustCHN==1
    replace n_f = r(N) if pat==`i' & trustCHN==1
	}
gen upper_f=mean_f+1.96*std_f/sqrt(n_f)
gen lower_f=mean_f-1.96*std_f/sqrt(n_f)
replace mean_f=round(mean_f, .01)

twoway (rcap lower_f upper_f pat) (scatter mean_f pat, mlabel(mean_f)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save trustCHN1, replace 

*(2) Support Rate: Not-trust CHN
gen mean_unf =.
gen std_unf =.
gen n_unf =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & trustCHN==0
	replace mean_unf = r(mean) if pat==`i' & trustCHN==0
    replace std_unf = r(sd) if pat==`i' & trustCHN==0
    replace n_unf = r(N) if pat==`i' & trustCHN==0
	}
gen upper_unf=mean_unf+1.96*std_unf/sqrt(n_unf)
gen lower_unf=mean_unf-1.96*std_unf/sqrt(n_unf)
replace mean_unf=round(mean_unf, .01)

twoway (rcap lower_unf upper_unf pat) (scatter mean_unf pat, mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save trustCHN0, replace 

*** Overlay for Manuscript (Support Rate by Treatment Group and by Use of Force Preference)
gen pata = pat+0.1
gen patb = pat-0.1
gen patall = pat+0.2

twoway (rcap lower_f upper_f patb) (scatter mean_f patb,msymbol(o) mlabel(mean_f))  (rcap lower_unf upper_unf pata) (scatter mean_unf pata ,msymbol(t) mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") ytitle("% ") legend(label(1 "Trust China") label(2 " ") label(3 "Non-trust China") label(4 " ")  rows(1) ) note("Note: Bars indicate 95% confidence intervals.") graphregion(color(white))
graph save trustCHNcon, replace 


***
* Main effect on Q1
***
use "UNSC Survey III (2014Sept4to10)c.dta", clear

gen mean_f =.
gen std_f =.
gen n_f =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i'
	replace mean_f = r(mean) if pat==`i'
    replace std_f = r(sd) if pat==`i'
    replace n_f = r(N) if pat==`i'
	}
gen upper_f=mean_f+1.96*std_f/sqrt(n_f)
gen lower_f=mean_f-1.96*std_f/sqrt(n_f)
replace mean_f=round(mean_f, .01)

twoway (rcap lower_f upper_f pat) (scatter mean_f pat, mlabel(mean_f)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.") graphregion(color(white))
graph display, ysize(5) xsize(6)
graph save trustMain, replace 


***
* Support RATE for Q1 by use of force preferences
***
use "UNSC Survey III (2014Sept4to10)c.dta", clear

*(1) Support Rate: Female 
gen mean_f =.
gen std_f =.
gen n_f =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & q09==2
	replace mean_f = r(mean) if pat==`i' & q09==2
    replace std_f = r(sd) if pat==`i' & q09==2
    replace n_f = r(N) if pat==`i' & q09==2
	}
gen upper_f=mean_f+1.96*std_f/sqrt(n_f)
gen lower_f=mean_f-1.96*std_f/sqrt(n_f)
replace mean_f=round(mean_f, .01)

twoway (rcap lower_f upper_f pat) (scatter mean_f pat, mlabel(mean_f)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save trustfm,, replace 

*(2) Support Rate: Male
gen mean_unf =.
gen std_unf =.
gen n_unf =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' &  q09==1
	replace mean_unf = r(mean) if pat==`i' &  q09==1
    replace std_unf = r(sd) if pat==`i' &  q09==1
    replace n_unf = r(N) if pat==`i' &  q09==1
	}
gen upper_unf=mean_unf+1.96*std_unf/sqrt(n_unf)
gen lower_unf=mean_unf-1.96*std_unf/sqrt(n_unf)
replace mean_unf=round(mean_unf, .01)

twoway (rcap lower_unf upper_unf pat) (scatter mean_unf pat, mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save trustm, replace 

*** Overlay for Manuscript (Support Rate by Treatment Group and by Use of Force Preference)
gen pata = pat+0.1
gen patb = pat-0.1
gen patall = pat+0.2

twoway (rcap lower_f upper_f patb) (scatter mean_f patb,msymbol(o) mlabel(mean_f))  (rcap lower_unf upper_unf pata) (scatter mean_unf pata ,msymbol(t) mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") ytitle("% ") legend(label(1 "Female") label(2 " ") label(3 "Male") label(4 " ")  rows(1) ) note("Note: Bars indicate 95% confidence intervals.") graphregion(color(white))
graph save gender, replace 


***
* Support RATE for Q1 by use of force preferences
***
use "UNSC Survey III (2014Sept4to10)c.dta", clear

generate college=0
replace college=1 if q10>6

*(1) Support Rate: College Education 
gen mean_f =.
gen std_f =.
gen n_f =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & college==1
	replace mean_f = r(mean) if pat==`i' &  college==1
    replace std_f = r(sd) if pat==`i' &  college==1
    replace n_f = r(N) if pat==`i' &  college==1
	}
gen upper_f=mean_f+1.96*std_f/sqrt(n_f)
gen lower_f=mean_f-1.96*std_f/sqrt(n_f)
replace mean_f=round(mean_f, .01)

twoway (rcap lower_f upper_f pat) (scatter mean_f pat, mlabel(mean_f)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save college, replace 

*(2) Support Rate: No College
gen mean_unf =.
gen std_unf =.
gen n_unf =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' &   college==0
	replace mean_unf = r(mean) if pat==`i' &  college==0
    replace std_unf = r(sd) if pat==`i' &  college==0
    replace n_unf = r(N) if pat==`i' &  college==0
	}
gen upper_unf=mean_unf+1.96*std_unf/sqrt(n_unf)
gen lower_unf=mean_unf-1.96*std_unf/sqrt(n_unf)
replace mean_unf=round(mean_unf, .01)

twoway (rcap lower_unf upper_unf pat) (scatter mean_unf pat, mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save nocollege, replace 

*** Overlay for Manuscript (Support Rate by Treatment Group and by Use of Force Preference)
gen pata = pat+0.1
gen patb = pat-0.1
gen patall = pat+0.2

twoway (rcap lower_f upper_f patb) (scatter mean_f patb,msymbol(o) mlabel(mean_f))  (rcap lower_unf upper_unf pata) (scatter mean_unf pata ,msymbol(t) mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") ytitle("% ") legend(label(1 "College") label(2 " ") label(3 "No College") label(4 " ")  rows(1) ) note("Note: Bars indicate 95% confidence intervals.") graphregion(color(white))
graph save collegeMain, replace 



***
* Support RATE for Q1 by use of force preferences
***
use "UNSC Survey III (2014Sept4to10)c.dta", clear

generate age=0
replace age=1 if q08>1969

*(1) Support Rate: Over 45 yo 
gen mean_f =.
gen std_f =.
gen n_f =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & age==0
	replace mean_f = r(mean) if pat==`i' & age==0
    replace std_f = r(sd) if pat==`i' & age==0
    replace n_f = r(N) if pat==`i' & age==0
	}
gen upper_f=mean_f+1.96*std_f/sqrt(n_f)
gen lower_f=mean_f-1.96*std_f/sqrt(n_f)
replace mean_f=round(mean_f, .01)

twoway (rcap lower_f upper_f pat) (scatter mean_f pat, mlabel(mean_f)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save o45, replace 

*(2) Support Rate: below 45 yo
gen mean_unf =.
gen std_unf =.
gen n_unf =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' &  age==1
	replace mean_unf = r(mean) if pat==`i' &  age==1
    replace std_unf = r(sd) if pat==`i' &  age==1
    replace n_unf = r(N) if pat==`i' &  age==1
	}
gen upper_unf=mean_unf+1.96*std_unf/sqrt(n_unf)
gen lower_unf=mean_unf-1.96*std_unf/sqrt(n_unf)
replace mean_unf=round(mean_unf, .01)

twoway (rcap lower_unf upper_unf pat) (scatter mean_unf pat, mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save b45, replace 

*** Overlay for Manuscript (Support Rate by Treatment Group and by Use of Force Preference)
gen pata = pat+0.1
gen patb = pat-0.1
gen patall = pat+0.2

twoway (rcap lower_f upper_f patb) (scatter mean_f patb,msymbol(o) mlabel(mean_f))  (rcap lower_unf upper_unf pata) (scatter mean_unf pata ,msymbol(t) mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") ytitle("% ") legend(label(1 "Over 45 yo") label(2 " ") label(3 "At and below 45 yo") label(4 " ")  rows(1) ) note("Note: Bars indicate 95% confidence intervals.") graphregion(color(white))
graph save age, replace 



***
* Support RATE for Q1 by use of force preferences
***
use "UNSC Survey III (2014Sept4to10)c.dta", clear

generate age=0
replace age=1 if q08>1979

*(1) Support Rate: Over 35 yo 
gen mean_f =.
gen std_f =.
gen n_f =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' & age==0
	replace mean_f = r(mean) if pat==`i' & age==0
    replace std_f = r(sd) if pat==`i' & age==0
    replace n_f = r(N) if pat==`i' & age==0
	}
gen upper_f=mean_f+1.96*std_f/sqrt(n_f)
gen lower_f=mean_f-1.96*std_f/sqrt(n_f)
replace mean_f=round(mean_f, .01)

twoway (rcap lower_f upper_f pat) (scatter mean_f pat, mlabel(mean_f)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save o35, replace 

*(2) Support Rate: below 45 yo
gen mean_unf =.
gen std_unf =.
gen n_unf =.
	
forvalues i=1(1)6 {
	sum support_dum if pat==`i' &  age==1
	replace mean_unf = r(mean) if pat==`i' &  age==1
    replace std_unf = r(sd) if pat==`i' &  age==1
    replace n_unf = r(N) if pat==`i' &  age==1
	}
gen upper_unf=mean_unf+1.96*std_unf/sqrt(n_unf)
gen lower_unf=mean_unf-1.96*std_unf/sqrt(n_unf)
replace mean_unf=round(mean_unf, .01)

twoway (rcap lower_unf upper_unf pat) (scatter mean_unf pat, mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") b1title("") xtitle("") legend(off) note("Note: Bars indicate 95% confidence intervals.")
graph display, ysize(5) xsize(6)
graph save b35, replace 

*** Overlay for Manuscript (Support Rate by Treatment Group and by Use of Force Preference)
gen pata = pat+0.1
gen patb = pat-0.1
gen patall = pat+0.2

twoway (rcap lower_f upper_f patb) (scatter mean_f patb,msymbol(o) mlabel(mean_f))  (rcap lower_unf upper_unf pata) (scatter mean_unf pata ,msymbol(t) mlabel(mean_unf)), xlab(1 "S" 2 "RV" 3 "CV" 4 "FV" 5 "UKV" 6 "USW") ytitle("% ") legend(label(1 "Over 35 yo") label(2 " ") label(3 "At and below 35 yo") label(4 " ")  rows(1) ) note("Note: Bars indicate 95% confidence intervals.") graphregion(color(white))
graph save age2, replace 


